package com.jms.mybatis.plus.beans.factory;

import com.baomidou.mybatisplus.core.mapper.Mapper;
import com.jms.framework.beans.factory.AbstractBeanFactory;
import com.jms.mybatis.plus.beans.MapperBeanDefinition;
import com.jms.mybatis.plus.proxy.MapperBeanProxy;

public class MapperBeanFactory extends AbstractBeanFactory<Mapper<?>> {

    public MapperBeanFactory(MapperBeanDefinition beanDefinition) {
        super(beanDefinition);
    }

    @Override
    public Mapper<?> getObject() throws Exception {
        Object object = MapperBeanProxy.getProxy(Class.forName(beanDefinition.getBeanClassName()));
        return (Mapper<?>) object;
    }

}
